<%@page import="com.kensure.shike.constant.BusiConstant"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html>
<jsp:include page="base/header.jsp" flush="true">
	<jsp:param value="信息内容编辑" name="pageTitle"/>
</jsp:include>
<script type="text/javascript" charset="utf-8" src="<%=BusiConstant.context%>/utf8-jsp/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="<%=BusiConstant.context%>/utf8-jsp/ueditor.all.min.js"> </script>
<!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
<script type="text/javascript" charset="utf-8" src="<%=BusiConstant.context%>/utf8-jsp/lang/zh-cn/zh-cn.js"></script>
<style>
	.pic{width:180px;height:180px;}
</style>

<body>


<style>
	.mainweb{
		width:100%;
		height:100%;
		overflow:auto;
	}
	.btop{
		position:absolute;
		top:10px;
		right:16px;
		width:100px;
		height:100px;
	}
</style>

<div style="padding: 15px;" class="mainweb layui-anim layui-anim-upbit">

	<fieldset class="layui-elem-field">
		<legend>信息详情</legend>
		<div class="layui-field-box">
			<form id="editForm" class="layui-form" lay-filter="form">
				<div class="layui-form-item">
					<label class="layui-form-label">公司名称</label>
					<div class="layui-inline">
						<input id="company-name" readonly type="text" name="title" style="width:600px;" class="layui-input" value="">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">公司地址</label>
					<div class="layui-inline">
						<input id="company-address" readonly type="text" name="title" style="width:600px;" class="layui-input" value="">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">商品</label>
					<div class="layui-inline" id="goods">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">公司地址</label>
					<div class="layui-inline">
						<textarea id="rule" readonly type="text" name="title" style="width:600px;height: 80px" class="layui-input" value=""></textarea>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">公司介绍</label>
					<div class="layui-inline">
						<textarea id="intro" readonly type="text" name="title" style="width:600px;height: 80px" class="layui-input" value=""></textarea>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">业绩及案例</label>
					<div class="layui-inline">
						<textarea id="cases" readonly type="text" name="title" style="width:600px;height: 80px" class="layui-input" value=""></textarea>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">营业执照</label>
					<div class="layui-inline" id="license">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">场所及厂房</label>
					<div class="layui-inline" id="place">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">证书</label>
					<div class="layui-inline" id="cert">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">视频</label>
					<div class="layui-inline" id="video">
					</div>
				</div>

			</form>
		</div>
	</fieldset>
</div>
</body>




<script>
	var id = getQueryVariable("id");

	function openImage(src) {
		window.open(src)
	}

	$(function(){
		if(id){
			var url = getbaseurl("/collect/get.do");
			var data = {id:id};
			postsync(url, data, function(data){
				var row = data.resultData.row;
				$('#company-name').val(row.companyName)
				$('#company-address').val(row.companyAddress)
				row.goods = JSON.parse(row.goods)
				var goods = ''
				row.goods.forEach((item, index) => {
					goods += `<div>
						<input id="company-name" readonly="" type="text" name="title" style="float: left;width:300px;" class="layui-input" value=商品：` + item.name + `>` +
					    `<input id="company-name" readonly="" type="text" name="title" style="float: left;width:300px;" class="layui-input" value=¥` + item.price + `>` +
					`<div>`
				})
				$('#goods').html(goods)
				$('#rule').val(row.rule)
				$('#intro').val(row.intro)
				$('#cases').val(row.cases)
				var images = ''
				row.license = JSON.parse(row.license)
				row.license.forEach(item => {
					images += `<img style="width: 100px; object-fit: cover;margin-right: 20px;" onclick="openImage('` + item + `')"` + ` src=` + item + '>'
				})
				$('#license').html(images)

				row.place = JSON.parse(row.place)
				var place = ''
				row.place.forEach(item => {
					place += `<img style="width: 100px; object-fit: cover;margin-right: 20px;" onclick="openImage('` + item + `')"` + ` src=` + item + '>'
				})
				$('#place').html(place)

				row.cert = JSON.parse(row.cert)
				var cert = ''
				row.cert.forEach(item => {
					cert += `<img style="width: 100px; object-fit: cover;margin-right: 20px;" onclick="openImage('` + item + `')"` + ` src=` + item + '>'
				})
				$('#cert').html(cert)

				//
				var video = ''
				row.video = JSON.parse(row.video)
				row.video.forEach(item => {
					video += `<iframe style="margin-right: 10px" class="video_iframe" src="http://v.qq.com/iframe/player.html?vid=` + item + `&amp;width=300&amp;height=200&amp;auto=0" allowfullscreen="" frameborder="0" height="200" width="300"></iframe>`
				})
				$('#video').html(video)
			}, null, null);
		}
	});

</script>


</html>